# 1_3练习 单词统计

file = open("D:/me/study/python/execise/基础语法2/一、文件/1_3 练习.txt",'r',encoding="UTF-8")

#方法1
file_str = file.read()
print(f"ithiema的数量为{file_str.count("itheima")}")


#方法2
# file_list = file.readlines()
#
# i = 0
# for x in file_list:
#     i+=x.count("itheima")
#     print(x)
#
# print(f"itheima的数量为{i}")

# 方法1
# file_str = file.read()
# file_str1 = file_str.replace("\n"," ")
# file_list = file_str1.split(" ")
# i = 0
# for x in file_list:
#     if x=="itheima":
#         i+=1
# print(f"itheima的数量为{i}")
